﻿$(document).ready(function () {
    var pageSize = 15;

    PageClickFunc(1)

    function PageClickFunc(pageclickednumber) {
        $.ajax({
            type: "post",
            data: { action: "GetList", pageIndex: pageclickednumber, pageSize: pageSize },
            datatype: "json",
            url: "../../Ajax/DayReportAjax.ashx",
            beforSend: function () {
            },
            success: function (data) {
                if (data != null) {
                    var json = $.parseJSON(data).json;
                    var pageCount = $.parseJSON(data).flag;
                    var tbody = "";
                    $.each(json, function (k, v) {
                        tbody += "<tr>"
                        tbody += "<td><lable name='lblTime'>";
                        tbody += v.ReportTime;
                        tbody += "</lable></td>";
                        tbody += "<td><lable name='lblNewUserCount'>";
                        tbody += v.NewUserCount;
                        tbody += "</lable></td>";
                        tbody += "<td><lable name='lblChargeCount'>";
                        tbody += v.ChargePerCount;
                        tbody += "</lable></td>";
                        tbody += "<td><lable name='lblPrice'>";
                        tbody += v.PagingPrice;
                        tbody += "</lable></td>";
                        tbody += "<td><lable name='lblTotalUserCount'>";
                        tbody += v.TotalUserCount;
                        tbody += "</lable></td>";
                        tbody += "<td><lable name='lblTotalChargePrice'>";
                        tbody += parseFloat(v.PagingTotalPrice).toFixed(2);
                        tbody += "</lable></td>";
                        tbody += "<td><lable name='lblTotalPenect'>";
                        tbody += parseFloat(v.PagingTotalPrice / v.TotalUserCount).toFixed(2);
                        tbody += "</lable></td>";
                        tbody += "</tr>"
                    })
                    $("#tb1").empty().append(tbody)
                    $("#pager").pager({ pagenumber: pageclickednumber, pagecount: Math.ceil(pageCount / pageSize), buttonClickCallback: PageClickFunc });
                }
            },
            complete: function () {
            },
            error: function () {
            }
        })
    }
})